<template>
  <view class="yuongjin">
    <view>
      <view class="list" v-for="item in data.list">
        <view class="flex flex_between">
          <view class="color1 flex flex_a_center"><span class="color2">{{ item.type_title }}</span></view>
          <view class="sumType sumType2" >{{ typeName[item.type] }}</view>
        </view>
        <view class="flex flex_between settle">
          <view class="color1 flex flex_a_end text" >时间：<span class="color2">{{ item.create_time ?
            item.create_time.slice(0,10) : "" }}</span></view>
          <view class="color1 flex flex_a_end text" >结算金额：<span class="color2">¥</span><span
               class="color2 num">{{ item.money }}</span></view>
        </view>
      </view>
    </view>

    <u-loadmore :status="status" />
  </view>
</template>

<script>
export default {
  components: {
  },
  mixins: [],
  data() {
    return {
      data: [],
      status: 'loadmore',
      page: 1,
      pageSize: 10,
      count: 0,
      options: {},
      typeName: ['','直推收益', '直推奖励', '间推奖励']
    }
  },
  onReachBottom(){
    if (this.status == 'nomore') {
      return;
    }
    this.page = ++ this.page;
    this.dataList(this.options.type)
  },
  onShow() {
    this.$api.sendRequest({
      url: "/api/member/judgeBuy",
      success: res => {
        console.log(res,'/api/member/judgeBuy');
        if(!res.data){
          uni.hideShareMenu()
        }
      }
    });
  },
  onLoad(options) {
    
    this.options = options
    this.dataList()
  },
  methods: {
    dataList() {
      this.status = 'loading';
        this.$api.sendRequest({
          url: '/api/member/liandongrewardlist',
          data: {
            page: this.page,
            pageSize: this.pageSize
          },
          success: res => {
            console.log(res.data.list,'res');
            this.data = res.data
            this.count = res.data.count
            this.status = this.data.list.length >= this.count ? 'nomore' : 'loadmore';
            console.log(this.data, 'this.data');
          }
        });
    }
  },
  onShareTimeline() {
    return {
      title: '鹏城快享',
      query: `source_member=${uni.getStorageSync("user_id")}`,
      imageUrl: ""
    }
  },
  onShareAppMessage() {
    return {
      title: "鹏城快享",
      path: `/pages/index/index?source_member=${uni.getStorageSync("user_id")}`,
      imageUrl: ''
    }
  },
};
</script>

<style lang="scss" scoped>
@import '@/common/css/diy.scss';
.flex_a_end {
  align-items: flex-end;
}

.flex_between {
  justify-content: space-between;
}
.flex {
  display: flex;
}
.yuongjin {
  margin: 20rpx 30rpx;
  padding-bottom: 30px;
  .list {
    border-radius: 9px;
    background-color: #fff;
    padding: 30rpx 25rpx;
    margin-bottom: 10px;

    .sumType {
      color: #fff;
      border-radius: 9rpx;
      padding: 8rpx 12rpx;
      margin-bottom: 10px;
    }

    .sumType1 {
      background-color: #25d48b;
    }

    .sumType2 {
      background-color: #ec692b;
    }

    

    .settle {
      .text {
        font-size: 14px;
        .num {
          font-size: 18px;
          font-weight: bold;
          margin-left: 6rpx;
        }
      }
    }
  }
}

.module {
  padding: 10px;
  background: #fff;
  border-radius: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
}
</style>
